home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
ca29_3.zip
/
BBMAINT2.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-03-24
|
24KB
|
907 lines
;**** TRACE ON ; Debugging
;
; ----- COM-AND BBS file maintenance script (Files file)
; Commenced: 11/90 R.McG
; -----------------------------------------------------------------------
; Purpose:
; The script, named BBMAINT2.CMD, produces the main window for
; Filedir functions of BBMAINT, and implements its functions. It
; is not directly callable itself.
; -----------------------------------------------------------------------
; Usage:
; N99 -> Text attribute value (Setup by BBMAINT.CMD)
; N98 -> BBMAINT Mainline cursor position
; N97 -> BBMAINT Mainline cursor position
; N96 -> our mainline cursor position
; N95 -> our mainline cursor position
; -----------------------------------------------------------------------
;
; This script is intended ONLY to be used for FCALL
;
IF NOT FCALLED
WOPEN 10,10,13,70 (cont) NOFIEsc
ATSAY 10,12 (cont) " BBS Files "
ATSAY 11,12 (cont) " The script: "*"_SCRIPT"
ATSAY 12,12 (cont) " is not used by itself... it is called through BBMAINT"
ATSAY 13,26 (cont) " Press any key to continue "
;
; Wait a keypress
;
KEYGET S0 ; Wait for any key
WCLOSE ; Close open window
EXIT ; Terminate right here
ENDIF
GOSUB FileFile ; Invoke function
FRETURN ; Return to caller
; -----------------------------------------------------------------------
; ----- NoFile: Inform that there's no BBS-FIle file to modify
;
NoFile:
WOPEN 10,10,13,70 (cont) NOFIEsc
ATSAY 10,12 (cont) " BBS FileDir "
ATSAY 11,12 (cont) " The file: "*S23&"\BBS-File"
ATSAY 12,12 (cont) " does not exist. Please create subdirectories first."
ATSAY 13,26 (cont) " Press any key to continue "
;
; Wait a keypress
;
KEYGET S0 ; Wait for any key
WCLOSE
NOFIEsc:
RETURN
; -----------------------------------------------------------------------
; ----- Subroutine: FileFile -> Update FILE directory
;
FileFile:
GOSUB NewFile ; Create if not there
IF NOT ISFILE S23&"\BBS-FIle"
GOSUB NoFile ; Inform there's no file
RETURN ; .. so we can't continue
ENDIF
;
; Open a window
;
WOPEN 0,0 23,79 (defa) File_Esc
ATSAY 0,2 (defa) " BBS Files "
ATSAY 23,25 (defa) " Press ESC to cancel BBMAINT "
;
; Paint the window
;
FIFI100:
CLEAR ; Clear window
LOCATE 2,2
MESS " 1) Add a file to the up/download list"
MESS " 2) Delete a file from the list"
MESS " 3) Modify a file's listing"
MESS " 4) Print the file list"
MESS " 5) View the file list"
MESS "──────────────────────────────────── "
MESS "Note: Alt-Q to edit a file"
MESS " Alt-F for a directory search"
MESS " Alt-F10 to shell to DOS"
MESS " "
MESS "──────────────────────────────────── "
MESS " "
MESS "Select item (carriage return = previous): "
CURSOR N96,N95 ; Read current cursor
;
; Wait for entry, and interpret
;
FIFI200:
LOCATE N96 N95 ; Reposition cursor
KEYGET S0 ; Wait for it
SWITCH S0 ; Act according to keyget
CASE "1"
GOSUB AddFile
ENDCASE
CASE "2"
GOSUB DelFile
ENDCASE
CASE "3"
GOSUB ModFile
ENDCASE
CASE "4"
GOSUB PrnFile
ENDCASE
CASE "5"
GOSUB ViewFile
GOTO FIFI100 ; Repaint after this
ENDCASE
CASE "0d" ; c/r alone is exit
WCLOSE ; Close window...
RETURN ; and return to caller
ENDCASE
CASE "_NULL" ; ESC -> Null
WCLOSE ; Close window...
RETURN ; Leave Main routine
ENDCASE
CASE "2100" ; Alt-F
MANUAL "0x2100" ; Perform Dir cmd
ENDCASE
CASE "1000" ; Alt-Q
MANUAL "0x1000" ; Edit a file
ENDCASE
CASE "7100" ; Alt-F10
SHELL
DWINDOW 1,2,22,78; Reset dwindow after shell
LEGEND "_LEGEND" ; Redo the legend
ENDCASE
DEFAULT ; None of the above
SOUND 100,100 ; Bronx cheer
ENDCASE
ENDSWITCH
GOTO FIFI200 ; Repaint screen and ask again
;
; End of Files procedure
;
File_Esc:
S0 = "" ; Fake null entry
RETURN ; Leave files routine
; -----------------------------------------------------------------------
; ----- AddFile: Add a file to the File directory
;
AddFile:
SET FLAG(0) OFF ; Flag for ESCAPE
WOPEN 10,10,16,75 (cont) ADFIEsc
ATSAY 10,12 (cont) " BBS Files Add "
ATSAY 11,12 (cont) "Enter the file to be added: "
ATSAY 16,26 (cont) " Press ESC to cancel "
;
; Wait a keypress
;
LOCATE 11,42
GET S0 12 ; get fname
IF FLAG(0) GOTO ADFIEnd ; Exit if ESC hit
LJ S0 ; Left justify - don't upper case
IF NULL S0 GOTO ADFIEnd ; get out on empty entry
GOSUB LkpFile ; Lookup name in files file
IF FOUND ; If its there we can't add it
WCLOSE ; Close open window
GOTO ModFI_Add ; Skip if file found
ENDIF
S10 = S0 ; Save File name
GOTO ADFI100 ; And branch around parallel code
;
; Entry from ModFile... Nothing to modify
;
AddFI_Mod:
WOPEN 10,10,16,75 (cont) ADFIEsc
ATSAY 10,12 (cont) " BBS Files Add "
ATSAY 11,12 (cont) "Enter the file to be added: "
ATSAY 11,42 (cont) S0
ATSAY 16,26 (cont) " Press ESC to cancel "
S10 = S0 ; Copy it for remainder
;
; Look for the file - Add date and size to listing
;
ADFI100:
FDATE S1 S23&"\"&S0 ; Ask for the file date (bbs-file subdir)
IF FAILED GOTO ADFI110 ; Skip if d.n.e
S10(12:19) = S1 ; Place date of file
FSIZE S1 S23&"\"&S0 ; Ask for the file size (bbs-file subdir)
IF FAILED GOTO ADFI110 ; Skip if d.n.e
S10(21:27) = S1 ; Place size of file (7 digits)
ATSAY 12,12 (cont) "File date and size:"
ATSAY 12,42 (cont) S10(12:27)
GOTO ADFI200 ; SKip around error handler
;
; File does not exist...
;
ADFI110:
ATSAY 12,12 (cont) "File d.n.e. Add anyway (y/n): "
LOCATE 12,42
GET S0 1 ; get resp
IF FLAG(0) GOTO ADFIEnd ; Exit if ESC hit
IF NULL S0 or NOT FIND "YN" S0(0)
SOUND 100,100 ; Indicate displeasure
GOTO ADFI110 ; Try again
ENDIF
IF FIND "N" S0(0)
WCLOSE ; Close window
GOTO AddFile ; And try again
ENDIF
S10(12:27) = "******** ********"
;
; Ask for a comment field
;
ADFI200:
ATSAY 13,12 (cont) "Comment text: "
LOCATE 13,26
GET S0 40 ; get resp
LJ S0 ; Left justify
IF FLAG(0) GOTO ADFIEnd ; Exit if ESC hit
IF NULL S0
SOUND 100,100 ; Indicate displeasure
GOTO ADFI200 ; Try again
ENDIF
S10(28:79) = S0 ; Save comment text
;
; Ask for privileged flag
;
ADFI250:
ATSAY 14,12 (cont) "Priveleged access (y/n): "
LOCATE 14,42
GET S0 1 ; get resp
IF FLAG(0) GOTO ADFIEnd ; Exit if ESC hit
IF NULL S0 or NOT FIND "YN" S0(0)
SOUND 100,100 ; Indicate displeasure
GOTO ADFI250 ; Try again
ENDIF
IF FIND "Y" S0(0) S10(20:20) = "P" ; Save priveleged access
;
; Ask for one more look
;
ADFI300:
ATSAY 15,12 (cont) "OK to add this record?: "
LOCATE 15,42
GET S0 1 ; get resp
IF FLAG(0) GOTO ADFIEnd ; Exit if ESC hit
IF NULL S0 or NOT FIND "YN" S0(0)
SOUND 100,100 ; Indicate displeasure
GOTO ADFI300 ; Try again
ENDIF
IF FIND "N" S0(0)
WCLOSE ; Close window
GOTO AddFile ; And try again
ENDIF
;
; Write the record
;
GOSUB AddFRec ; Write to Files file
;
; End of add procedure
;
ADFIEnd:
WCLOSE
ADFIEsc:
SET FLAG(0) ON
RETURN
; -----------------------------------------------------------------------
; ----- AddFRec: Add a record to the file file...
; .. S10 passes the record to be written
;
AddFRec:
FOPENO S23&"\BBS-File" TEXT APPEND
IF NOT SUCCESS ; Open failed
S0 = "Error opening: "*S23&"\BBS-File"
GOSUB Error ; Report
RETURN ; And we're done
ENDIF
PRESERVE S10 ; Preserve ^'s and !'s
WRITE S10 ; Write the record
WRITE "!^Z" ; And finish it
FCLOSEO
RETURN
; -----------------------------------------------------------------------
; ----- LkpFile: Lookup a file in the BBS-File file
; .. S0 passes the fname to be tested
; .. S10 returns the record read
;
LkpFIle:
FOPENI S23&"\BBS-File" T